package com.vne.skyemart.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.vne.skyemart.dao.CartDao;
import com.vne.skyemart.model.Cart;
import com.vne.skyemart.service.CartService;

@Service("cartService")
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class CartServiceImpl implements CartService{
	@Autowired
	private CartDao cartDao;

	public CartDao getCartDao() {
		return cartDao;
	}

	public void setCartDao(CartDao cartDao) {
		this.cartDao = cartDao;
	}
	public CartServiceImpl() {}
	@Transactional(propagation = Propagation.SUPPORTS,readOnly = false)
	@Override
	public void addCart(Cart cart) {
		cartDao.save(cart);		
	}

	@Override
	public List<Cart> listCart() {
		return cartDao.findAll();
	}
}
